from django.db import models


class Film(models.Model):
    """影票模型"""
    # cinema = models.ForeignKey(Cinema, on_delete=models.CASCADE, verbose_name="关联影院")
    type = models.IntegerField(default=1, verbose_name="类型")
    poster = models.URLField(max_length=500, verbose_name="海报")
    name = models.CharField(max_length=255, verbose_name="电影名称")
    grade = models.CharField(max_length=10, verbose_name="评分")
    actors = models.TextField(verbose_name="演员信息")
    nation = models.CharField(max_length=100, verbose_name="国家/地区")
    runtime = models.IntegerField(verbose_name="片长(分钟)")
    category = models.CharField(max_length=200, verbose_name="分类")
    filmType = models.CharField(max_length=50, verbose_name="电影类型")
    synopsis = models.TextField(verbose_name="剧情简介")
    photos = models.TextField(verbose_name="剧照")
    recommend = models.IntegerField(default=0, verbose_name="推荐指数")
    address = models.CharField(max_length=500, blank=True, verbose_name="地址")
    created_at = models.CharField(max_length=50, blank=True, verbose_name="创建时间")

    class Meta:
        db_table = 'film'
        verbose_name = '影票'
        verbose_name_plural = '影票'
        ordering = ['-recommend', '-created_at']

    def __str__(self):
        return self.name
